<template>
    <div class=''>123
        <button @click="login1">登录</button>
    </div>
</template>

<script>
import { login,getUserInfo } from './api/user/userApi';
export default {
    data () {
        return {
            
        };
    },
    components: {
        
    },
    created() {
        
    },
    mounted() {
        
    },
    methods: {
        login1() {
            console.log('login1');
            login({
                username: 'admin2',
                password: 'admin2'
            }).then(res => {
                console.log(res.code);
                localStorage.setItem('token', res.data);
                console.log(res);
                if(res.code === 200){
                    getUserInfo({
                        headers: {
                            token: res.data
                        }
                    })
                    .then(res => {
                        console.log(res);
                    });
                }
            });
        }
    },
};
</script>

<style>

</style>